package com.example.infra.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.infra.po.RolePo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper extends BaseMapper<RolePo> {

    @Select("SELECT r.* FROM roles r \n" +
            "JOIN users_roles ur ON r.id = ur.role_id \n" +
            "WHERE ur.user_id = #{userId}")
    List<RolePo> selectByUserId(Integer userId);
}


